/*
 * @Author: chen haoxuan
 * @Date: 2021-05-24 22:58:39
 * @LastEditTime: 2021-05-24 23:18:29
 */
#include <iostream>
using namespace std;
class Matrix
{
public:
    Matrix() { matrix[2][3] = {0}; };
    void input_matrix();
    void display_matrix();
    Matrix operator+(Matrix &c);

private:
    int matrix[2][3];
};
Matrix Matrix::operator+(Matrix &c)
{
    Matrix temp;
    temp.matrix[2][3] = {0};
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            temp.matrix[i][j] = matrix[i][j] + c.matrix[i][j];
        }
    }
    return temp;
}
void Matrix::input_matrix()
{
    cout << "Please enter a 2x3 matrix: " << endl;
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cin >> matrix[i][j];
        }
    }
}
void Matrix::display_matrix()
{
    for (int i = 0; i < 2; i++)
    {
        for (int j = 0; j < 3; j++)
        {
            cout << matrix[i][j] << " ";
        }
        cout << endl;
    }
}
int main()
{
    Matrix m1, m2, m3;
    m1.input_matrix();
    cout<<"m1= "<<endl;
    m1.display_matrix();
    m2.input_matrix();
    cout<<"m2= "<<endl;
    m2.display_matrix();
    m3 = m1 + m2;
    cout<<"m3= "<<endl;
    m3.display_matrix();
    system("pause");
    return 0;
}